eeprom16 2.2.1
Loading...
Searching...
No Matches
eeprom16


EEPROM 16 Click

EEPROM 16 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Mar 2025.
  • Type : SPI type

Software Support

Example Description

This example demonstrates the use of EEPROM 16 Click board by writing specified data to the memory and reading it back.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.EEPROM16

Example Key Functions

  • eeprom16_cfg_setup This function initializes Click configuration structure to initial values.
    void eeprom16_cfg_setup(eeprom16_cfg_t *cfg)
    EEPROM 16 configuration object setup function.
    EEPROM 16 Click configuration object.
    Definition eeprom16.h:176
  • eeprom16_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t eeprom16_init(eeprom16_t *ctx, eeprom16_cfg_t *cfg)
    EEPROM 16 initialization function.
    EEPROM 16 Click context object.
    Definition eeprom16.h:159
  • eeprom16_default_cfg This function executes a default configuration of EEPROM 16 Click board.
    err_t eeprom16_default_cfg(eeprom16_t *ctx)
    EEPROM 16 default configuration function.
  • eeprom16_memory_write This function writes a desired number of data bytes starting from the selected memory address.
    err_t eeprom16_memory_write ( eeprom16_t *ctx, uint16_t address, uint8_t *data_in, uint8_t len );
    err_t eeprom16_memory_write(eeprom16_t *ctx, uint16_t address, uint8_t *data_in, uint8_t len)
    EEPROM 16 memory write function.
  • eeprom16_memory_read This function reads a desired number of data bytes starting from the selected memory address.
    err_t eeprom16_memory_read ( eeprom16_t *ctx, uint16_t address, uint8_t *data_out, uint16_t len );
    err_t eeprom16_memory_read(eeprom16_t *ctx, uint16_t address, uint8_t *data_out, uint16_t len)
    EEPROM 16 memory read function.

Application Init

Initializes the driver and performs the Click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
eeprom16_cfg_t eeprom16_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
eeprom16_cfg_setup( &eeprom16_cfg );
if ( SPI_MASTER_ERROR == eeprom16_init( &eeprom16, &eeprom16_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( EEPROM16_ERROR == eeprom16_default_cfg ( &eeprom16 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ EEPROM16_ERROR
Definition eeprom16.h:201
#define EEPROM16_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition eeprom16.h:143
void application_init(void)
Definition main.c:37
#define MIKROBUS_POSITION_EEPROM16
Definition main.c:27

Application Task

Writes a desired number of bytes to the memory and then verifies if it is written correctly by reading from the same memory location and displaying the memory content on the USB UART.

void application_task ( void )
{
uint8_t data_buf[ EEPROM16_PAGE_SIZE + 1 ] = { 0 };
log_printf ( &logger, "\r\n Memory address: 0x%.4X\r\n", ( uint16_t ) STARTING_ADDRESS );
{
log_printf ( &logger, " Write data: %s\r\n", ( char * ) DEMO_TEXT_MESSAGE_1 );
}
data_buf, strlen ( DEMO_TEXT_MESSAGE_1 ) ) )
{
log_printf ( &logger, " Read data: %s\r\n", data_buf );
}
{
log_printf ( &logger, " Write data: %s\r\n", ( char * ) DEMO_TEXT_MESSAGE_2 );
}
data_buf, strlen ( DEMO_TEXT_MESSAGE_2 ) ) )
{
log_printf ( &logger, " Read data: %s\r\n", data_buf );
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
@ EEPROM16_OK
Definition eeprom16.h:200
#define EEPROM16_PAGE_SIZE
Definition eeprom16.h:113
void application_task(void)
Definition main.c:73
#define DEMO_TEXT_MESSAGE_2
Definition main.c:31
#define DEMO_TEXT_MESSAGE_1
Definition main.c:30
#define STARTING_ADDRESS
Definition main.c:32

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.